package com.ruoyi.system.domain.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.enums.HttpMethodEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;

/**
 * @author nanyang
 */
public class TInterfaceDto {

    @Data
    @ApiModel(description = "新增接口")
    public static class Insert {
        @ApiModelProperty("类型id")
        private Long categoryId;
        @ApiModelProperty("名称")
        @NotNull(message = "接口名称不能为空")
        private String name;
        @NotNull(message = "接口URI不能为空")
        @ApiModelProperty("接口uri")
        private String uri;
        @NotNull(message = "请求方法不能为空")
        @ApiModelProperty("请求方法(GET、POST、PUT、DELETE、PATCH)，后台用了枚举，直接传括号内对应字符串即可")
        private HttpMethodEnum method;
        @ApiModelProperty("code")
        @NotNull(message = "请求CODE不能为空")
        private String code;
        @ApiModelProperty("Content-Type")
        @NotNull(message = "Content-Type不能为空")
        private String contentType;
        @ApiModelProperty("输入参数")
        private String inputParam;
        @ApiModelProperty("入参示例")
        private String input;
        @ApiModelProperty("输入参数")
        private String outputParam;
        @ApiModelProperty("出参示例")
        private String output;
        @ApiModelProperty("排序")
        @NotNull(message = "排序不能为空")
        private String sort;
        @ApiModelProperty("禁用启用状态（0正常 1暂停）")
        private Byte status;
    }

    @Data
    @ApiModel(description = "导入导出接口")
    public static class Export {
        @ApiModelProperty("类型id")
        private Long categoryId;
        @Excel(name = "接口类型")
        @ApiModelProperty("接口类型")
        private String categoryName;
        @Excel(name = "接口名称")
        @ApiModelProperty("接口名称")
        @NotNull(message = "接口名称不能为空")
        private String name;
        @Excel(name = "接口URI")
        @NotNull(message = "接口URI不能为空")
        @ApiModelProperty("接口uri")
        private String uri;
        @Excel(name = "请求方法")
        @NotNull(message = "请求方法不能为空")
        @ApiModelProperty("请求方法(GET、POST、PUT、DELETE、PATCH)，后台用了枚举，直接传括号内对应字符串即可")
        private String methodString;
        @Excel(name = "CODE")
        @ApiModelProperty("code")
        @NotNull(message = "请求CODE不能为空")
        private String code;
        @Excel(name = "Content-Type")
        @ApiModelProperty("Content-Type")
        @NotNull(message = "Content-Type不能为空")
        private String contentType;
        @Excel(name = "输入参数")
        @ApiModelProperty("输入参数")
        private String inputParam;
        @Excel(name = "入参示例")
        @ApiModelProperty("入参示例")
        private String input;
        @Excel(name = "输出参数")
        @ApiModelProperty("输出参数")
        private String outputParam;
        @Excel(name = "出参示例")
        @ApiModelProperty("出参示例")
        private String output;
        @ApiModelProperty("排序")
        @NotNull(message = "排序不能为空")
        @Excel(name = "排序")
        private String sort;
        @Excel(name = "禁用启用状态（0正常 1暂停）")
        @ApiModelProperty("禁用启用状态（0正常 1暂停）")
        private String status;


    }


    @Data
    @ApiModel("修改接口")
    public static class Update {
        @ApiModelProperty("ID")
        private Long id;
        @ApiModelProperty("类型id")
        private Long categoryId;
        @ApiModelProperty("名称")
        private String name;
        @ApiModelProperty("接口uri")
        private String uri;
        @ApiModelProperty("请求方法(GET、POST、PUT、DELETE、PATCH)，后台用了枚举，直接传括号内对应字符串即可")
        private String method;
        @ApiModelProperty("code")
        private String code;
        @ApiModelProperty("Content-Type")
        private String contentType;
        @ApiModelProperty("Body参数")
        private String body;
        @ApiModelProperty("输入参数")
        private String inputParam;
        @ApiModelProperty("入参示例")
        private String input;
        @ApiModelProperty("输入参数")
        private String outputParam;
        @ApiModelProperty("出参示例")
        private String output;
        @ApiModelProperty("排序")
        private String sort;
        @ApiModelProperty("禁用启用状态（0正常 1暂停）")
        private Byte status;
    }

    @Data
    @ApiModel("删除接口")
    public static class Delete {
        @ApiModelProperty("删除ID")
        private List<Long> idList;
    }


    @Data
    @ApiModel("查询接口")
    public static class Query {
        @ApiModelProperty("分类id")
        private Long categoryId;
        @ApiModelProperty("接口名称")
        private String name;
        @ApiModelProperty("接口uri")
        private String uri;
        @ApiModelProperty("请求方法")
        private Byte method;
        @ApiModelProperty("code")
        private String code;
    }

    @Data
    @ApiModel("新增接口分类")
    public static class CategoryInsert {
        @ApiModelProperty("父id")
        private Long parentId = 0L;
        @ApiModelProperty("名称")
        private String name;
        @ApiModelProperty("顺序号")
        private Integer orderNum;
    }

    @Data
    @ApiModel("修改接口分类")
    public static class CategoryUpdate {
        @ApiModelProperty("id")
        private Long id;
        @ApiModelProperty("父id")
        private Long parentId;
        @ApiModelProperty("名称")
        private String name;
        @ApiModelProperty("顺序号")
        private Integer orderNum;
    }

    @Data
    @ApiModel("删除接口分类")
    public static class CategoryDelete {
        @ApiModelProperty("id集合")
        private List<Long> idList;
    }

    @Data
    @ApiModel("查询接口分类")
    public static class QueryCategory {
        @ApiModelProperty("名称")
        private String name;
    }

    @Data
    @ApiModel("树形图查询接口分类")
    public static class TreeCategory {
        @ApiModelProperty("id")
        private Long id;
    }

    @Data
    @ApiModel("接口日志查询")
    public static class LogQuery {
        @ApiModelProperty("接口名称")
        private String name;
        @ApiModelProperty("APPID")
        private String appId;
        @ApiModelProperty("调用状态  成功、失败")
        private Byte status;

        @ApiModelProperty("开始时间，格式为yyyy-MM-dd HH:mm:ss")
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        private Date startTime;

        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
        @ApiModelProperty("结束时间，格式为yyyy-MM-dd HH:mm:ss")
        private Date endTime;
    }

}
